package com.mimosa.util.extract;

import java.util.HashSet;
import java.util.Set;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 抽取结果信息
 * 
 * @filename ExtractHit.java
 * @datetime 2013年9月6日 下午6:22:22
 * @author ggeagle
 * 
 */
public class ExtractHit {
	/**
	 * 字典值
	 */
	private String value;
	/**
	 * 次数统计
	 */
	private Integer count = 0;
	/**
	 * 出现位置信息
	 */
	private Set<Integer> indexs = new HashSet<Integer>();

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public Set<Integer> getIndexs() {
		return indexs;
	}

	public void addIndexPoint(Integer index) {
		this.indexs.add(index);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((value == null) ? 0 : value.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ExtractHit other = (ExtractHit) obj;
		if (value == null) {
			if (other.value != null)
				return false;
		} else if (!value.equals(other.value))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}
}